package servlet;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import DAO.RequisitionInfoDAO;

public class CreateGZSQ extends HttpServlet 
{
	private static final long serialVersionUID = 1L;
       
    public CreateGZSQ() 
    {
        super();
    }
    
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
           
	    request.setCharacterEncoding("utf-8");
		response.setCharacterEncoding("utf-8");
		response.setContentType("text/plain");
		PrintWriter out = response.getWriter();   
	    String department = request.getParameter("department");
	    String proposer = request.getParameter("proposer");
	    String time = request.getParameter("time");
	    String deviceName = request.getParameter("deviceName");
	    String model = request.getParameter("model");
	    String produceUnit = request.getParameter("produceUnit");
	    String quantity = request.getParameter("quantity");
	    String money = request.getParameter("money");
	    String reason = request.getParameter("reason");
	    String purchaseCondition = request.getParameter("purchaseCondition");
	    String personCondition = request.getParameter("personCondition");
	    String economyBenefit = request.getParameter("economyBenefit");
	    String useRate = request.getParameter("useRate");
	    String nowStatus = request.getParameter("nowStatus");
	    String remark = request.getParameter("remark");
	        
	    RequisitionInfoDAO requisition = new RequisitionInfoDAO();
	    requisition.createRequisitionInfo(department, proposer, time, deviceName, model, 
	    		                          produceUnit, quantity, money, reason, purchaseCondition,
	    		                          personCondition, economyBenefit, useRate, nowStatus, remark);
	    
	    out.print("{success:true,msg:'保存成功'}");
	    	   	    	  
	}
	
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doGet(request, response);
	}
}
